﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Framework;

namespace Enterprise.Admin.Handle
{
    public partial class EditPages : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                var id = Fq("CoPageId").SafeToInt();
                var title = Fq("CoTitle").SafeToString();
                var content = Fq("CoContent").SafeToString();
                var summary = Fq("CoSummary").SafeToString();
                var reservedUrl = Fq("CoReservedUrl").SafeToString();
                var author = Fq("CoAuthor").SafeToString();
                var columnId = Fq("CoColumnId").SafeToInt();
                var language = Fq("CoLanguage").SafeToString();
                var date = Fq("CoDate").SafeToDateTime();
                var isReserved = Fq("CoIsReserved").SafeToBool();
                var isPopular = Fq("CoIsPopular").SafeToBool();
                var isTop = Fq("CoIsTop").SafeToBool();
                var isRecommend = Fq("CoIsRecommend").SafeToBool();
                var keyWord = Fq("CoKeyWord").SafeToString();
                var description = Fq("CoDescription").SafeToString();
                var keyName = Fq("CoKeyName").SafeToString();
                var path = Fq("CoPath").SafeToString();
                var pageService = new PageService();
                pageService.Edit(id, columnId, title, content, summary, author, language, reservedUrl, date, isRecommend, isReserved, isPopular, isTop, keyWord, description, keyName, path);
                result = new { state = true, message = "修改成功" };
            }
            catch (Exception ex)
            {
                result = new { state = false, message = ex.Message };
            }
            Json(result);

        }
    }
}